package com.nbsaas.boot.cms.rest.resource;

import com.nbsaas.boot.cms.api.apis.PageApi;
import com.nbsaas.boot.cms.data.entity.Page;
import com.nbsaas.boot.cms.api.domain.request.PageRequest;
import com.nbsaas.boot.cms.api.domain.response.PageResponse;
import com.nbsaas.boot.cms.api.domain.simple.PageSimple;
import com.nbsaas.boot.cms.rest.convert.PageSimpleConvert;
import com.nbsaas.boot.cms.rest.convert.PageEntityConvert;
import com.nbsaas.boot.cms.rest.convert.PageResponseConvert;
import com.nbsaas.boot.cms.data.repository.PageRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   页面-业务接口实现
*/
@Transactional
@Service
public class PageResource extends BaseResource<Page,PageResponse, PageSimple, PageRequest>  implements PageApi {

    @Resource
    private PageRepository pageRepository;

    @Override
    public JpaRepositoryImplementation<Page, Serializable> getJpaRepository() {
        return pageRepository;
    }

    @Override
    public Function<Page, PageSimple> getConvertSimple() {
        return new PageSimpleConvert();
    }

    @Override
    public Function<PageRequest, Page> getConvertForm() {
        return new PageEntityConvert();
    }

    @Override
    public Function<Page, PageResponse> getConvertResponse() {
        return new PageResponseConvert();
    }




}


